body {
    font-family: 'Arial', sans-serif;
    background-color: #fff;
    color: #000;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden; /* 防止水平滚动条 */
}

.game-container {
    width: 800px;
    max-width: 100%;
    background-color: #fff;
    border: 2px solid #000;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

.game-banner {
    width: 100%;
    text-align: center;
    padding: 10px 0;
    background-color: #fff;
}

.game-banner img {
    max-width: 80%;
    height: auto;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px;
    background-color: #f5f5f5;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    min-height: 40px;
    flex-wrap: wrap;
}

.score-display, .timer-display {
    font-size: 16px;
    color: #000;
    margin: 5px 0;
}

.score-display h2, .timer-display h2 {
    margin: 0;
    font-size: 16px;
    white-space: nowrap;
}

.timer-display.urgent {
    animation: blink 0.5s infinite alternate;
}

@keyframes blink {
    from { color: #000; }
    to { color: #fff; background-color: #000; }
}

.button-container {
    display: flex;
    gap: 10px;
    margin: 5px 0;
}

button {
    padding: 6px 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

#startButton, #restartButton {
    font-size: 18px;
    font-weight: bold;
    padding: 6px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#aboutButton {
    font-size: 14px;
    padding: 5px 10px;
    margin-top: 5px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.game-view {
    position: relative;
    width: 100%;
    height: auto;
    background-color: #fff;
    overflow: hidden;
}

canvas {
    display: block;
    max-width: 100%;
    height: auto;
    image-rendering: pixelated; /* 保持像素清晰 */
    image-rendering: crisp-edges;
}

.game-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.controls {
    padding: 10px 20px;
    background-color: #f5f5f5;
    color: #333;
    font-size: 14px;
    text-align: center;
    border-top: 1px solid #000;
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
    z-index: 1000;
    text-align: center;
    padding: 20px;
}

.game-over h2 {
    font-size: 32px;
    margin-bottom: 20px;
}

.game-over p {
    font-size: 20px;
    margin: 10px 0;
}

.congrats-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.congrats-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    max-width: 80%;
}

.congrats-content h2 {
    color: #4CAF50;
    font-size: 28px;
    margin-bottom: 20px;
}

.congrats-content p {
    font-size: 18px;
    margin: 10px 0;
}

.congrats-content button {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
}

.congrats-content button:hover {
    background-color: #45a049;
}

.power-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.8);
    color: #000;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    z-index: 100;
    border: 2px solid #000;
    animation: fadeIn 0.3s, fadeOut 0.3s 1.7s;
}

/* 关于游戏按钮和弹窗样式 */
.about-container {
    text-align: center;
    padding: 10px;
    background-color: #f5f5f5;
    border-top: 1px solid #000;
}

#aboutButton:hover {
    background-color: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.about-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.about-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    border: 2px solid #000;
    width: 80%;
    max-width: 500px;
    text-align: left;
    position: relative;
}

.about-content h2 {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #000;
    padding-bottom: 10px;
}

.about-content p {
    margin: 10px 0;
    line-height: 1.5;
}

.about-content .credits {
    margin-top: 20px;
    font-style: italic;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
}

.close-button:hover {
    color: #555;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 响应式设计 */
@media (max-width: 820px) {
    .game-container {
        width: 100%;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    canvas {
        width: 100%;
        height: auto;
    }
}

@media (max-width: 600px) {
    .game-info {
        flex-direction: row;
        padding: 5px 10px;
        justify-content: center;
        gap: 10px;
    }
    
    .score-display, .timer-display {
        font-size: 14px;
    }
    
    .score-display h2, .timer-display h2 {
        font-size: 14px;
    }
    
    /* 在小屏幕上调整得分和豆子信息的显示 */
    .score-display h2 span {
        display: inline-block;
        margin-right: 3px;
    }
    
    .button-container {
        margin: 5px 0;
        gap: 5px;
    }
    
    #startButton, #restartButton {
        font-size: 16px;
        padding: 5px 10px;
    }
    
    #aboutButton {
        font-size: 12px;
        padding: 4px 8px;
    }
}

@media (max-width: 768px) {
    .game-info {
        padding: 5px 15px;
    }
    
    .score-display h2, .timer-display h2 {
        font-size: 15px;
    }
    
    #startButton, #restartButton {
        font-size: 16px;
        padding: 5px 12px;
    }
}

@media (max-width: 480px) {
    .game-info {
        padding: 4px 8px;
        justify-content: space-around;
    }
    
    .score-display, .timer-display {
        font-size: 13px;
    }
    
    .score-display h2, .timer-display h2 {
        font-size: 13px;
    }
    
    /* 在更小的屏幕上可能需要调整布局 */
    .score-display h2 {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #startButton, #restartButton {
        font-size: 14px;
        padding: 4px 8px;
    }
    
    #aboutButton {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .congrats-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .congrats-content h2 {
        font-size: 24px;
    }
    
    .congrats-content p {
        font-size: 16px;
    }
    
    .game-over h2 {
        font-size: 28px;
    }
    
    .game-over p {
        font-size: 18px;
    }
}

button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#startButton:hover, #restartButton:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#aboutButton:hover {
    background-color: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 游戏结束弹窗样式 */
.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-in-out;
}

.game-over-content {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    max-width: 500px;
    width: 80%;
    text-align: center;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-over-content h2 {
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 28px;
}

.game-over-content p {
    color: #555;
    margin-bottom: 15px;
    font-size: 18px;
}

.restart-button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.restart-button:hover {
    background-color: #45a049;
}